From c50a971459cebd55833ef1d3a50c75c3c4c3975a Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 22 Sep 2005 11:04:30 +0100 Subject: [PATCH] This fixes the "make check" feature of xenstore to properly compile with x86-64. When compiling you would get the following error since on x86-64 it was passing a long , when you are expecting an int. Signed-off-by: Jerone Young --- tools/xenstore/xs_random.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tools/xenstore/xs_random.c b/tools/xenstore/xs_random.c index 04a0411396..ebda938e37 100644 --- a/tools/xenstore/xs_random.c +++ b/tools/xenstore/xs_random.c @@ -74,9 +74,9 @@ static void convert_to_dir(const char *dirname) static void maybe_convert_to_directory(const char *filename) { struct stat st; - char *dirname = talloc_asprintf(filename, "%.*s", - strrchr(filename, '/') - filename, - filename); + char *dirname = talloc_asprintf( + filename, "%.*s", + (int)(strrchr(filename, '/') - filename), filename); if (lstat(dirname, &st) == 0 && S_ISREG(st.st_mode)) convert_to_dir(dirname); } @@ -249,7 +249,7 @@ static void init_perms(const char *filename) /* Copy permissions from parent */ command = talloc_asprintf(filename, "cp %.*s/.perms %s", - strrchr(filename, '/') - filename, + (int)(strrchr(filename, '/') - filename), filename, permfile); do_command(command); } @@ -308,7 +308,7 @@ static char *parent_filename(const char *name) char *slash = strrchr(name + 1, '/'); if (!slash) return talloc_strdup(name, "/"); - return talloc_asprintf(name, "%.*s", slash-name, name); + return talloc_asprintf(name, "%.*s", (int)(slash-name), name); } static void make_dirs(const char *filename) @@ -1063,7 +1063,8 @@ static unsigned int try_simple(const bool *trymap, ret = do_next_op(data->ops, h, i + data->seed, verbose); if (verbose) - printf("-> %.*s\n", strchr(ret, '\n') - ret, ret); + printf("-> %.*s\n", + (int)(strchr(ret, '\n') - ret), ret); if (streq(ret, "FAILED:Bad file descriptor")) goto out; if (kill(daemon_pid, 0) != 0) @@ -1334,13 +1335,14 @@ static unsigned int try_diff(const bool *trymap, file = do_next_op(&file_ops, fileh, i+data->seed, verbose); if (verbose) - printf("-> %.*s\n", strchr(file, '/') - file, file); + printf("-> %.*s\n", + (int)(strchr(file, '/') - file), file); if (verbose) printf("XS: "); xs = do_next_op(&xs_ops, xsh, i+data->seed, verbose); if (verbose) - printf("-> %.*s\n", strchr(xs, '/') - xs, xs); + printf("-> %.*s\n", (int)(strchr(xs, '/') - xs), xs); if (!streq(file, xs)) goto out; @@ -1508,7 +1510,8 @@ static unsigned int try_fail(const bool *trymap, aborted++; if (verbose) - printf("-> %.*s\n", strchr(ret, '\n') - ret, ret); + printf("-> %.*s\n", + (int)(strchr(ret, '\n') - ret), ret); talloc_free(ret); -- 2.30.2